use crate::rpc::pb::infra::infra_service_server::InfraService;
use crate::rpc::service::ServiceManager;
use sea_orm::DatabaseConnection;
use tonic::async_trait;

use crate::rpc::pb::dict::*;

pub struct ServiceImpl {
    services: ServiceManager,
}

impl ServiceImpl {
    pub fn new(db: DatabaseConnection) -> Self {
        Self {
            services: ServiceManager::new(db),
        }
    }
}

#[async_trait]
impl InfraService for ServiceImpl {
    async fn get_dict_type_list(
        &self,
        request: tonic::Request<GetDictTypeListReq>,
    ) -> Result<tonic::Response<GetDictTypeListResp>, tonic::Status> {
        self.services.dict.get_dict_type_list(request).await
    }

    async fn get_dict_type(
        &self,
        request: tonic::Request<GetDictTypeReq>,
    ) -> Result<tonic::Response<GetDictTypeResp>, tonic::Status> {
        self.services.dict.get_dict_type(request).await
    }
}
/// 生成客户端方法的宏
#[macro_export]
macro_rules! impl_client_methods {
    () => {};
}
